<template>
	<view :class="isDark?'darkBg':''">
		<cu-custom :bgColor="isDark?'bg-black':'bg-orange'" isBack="true">
			<block slot="backText">返回</block>
			<block slot="content">录取查询</block>
		</cu-custom>
		<view style="height: 545rpx; background-size: cover;  background-position: center;"
			:style="{backgroundImage:isDark?'url(https://web.cloudduolc.cn/image/adblack7.png)':'url(https://web.cloudduolc.cn/image/adwhite5.png)'}">
			<ad unit-id="adunit-b1c61a406515258a" ad-type="video" :ad-theme="isDark?'black':'white'"></ad>
		</view>
		<view :class="isDark?'dark':''" class="margin-bottom-xl">
			<view class="cu-bar  solid-bottom" style="font-weight:bold" :class="isDark?'dark':'bg-white'">
				<view class="action">
					<text class="cuIcon-titles text-orange"></text> 录取查询
				</view>
			</view>
			<view class="margin  padding radius " :class="isDark?'darkIn':'bg-white'">
				<form class="form" @submit="formSubmit">

					<view class="cu-form-group " :class="isDark?'darkIn':'light'"
						style="border-bottom: 1rpx solid #eee;">
						<view class="title">考生号</view>
						<input name="kh" placeholder="请输入考生号" :value="kh"></input>

					</view>

					<view class="margin">
						<text style="color: gray;">注意*(广东考生请输入10位高考考生号，省外考生请输入“22”开头的14位考生号)</text>
					</view>
					<view class="cu-form-group " :class="isDark?'darkIn':'light'">

						<view class="title">姓名</view>
						<input name="xm" placeholder="请输入姓名" :value="xm"></input>

					</view>
					<view class="cu-form-group " :class="isDark?'darkIn':'light'"
						style="border-bottom: 1rpx solid #eee;">

						<view class="title">身份证号后6位</view>
						<input name="sfzh" placeholder="请输入身份证后6位" :value="sfzh"></input>
					</view>

					<view class="margin"><text style="color:gray;">注意*(如包含字母，请使用大写。港澳台考生请输入“000000”)</text></view>
					<view class="cu-bar btn-group" :class="isDark?'darkIn':'light'">
						<button class="cu-btn bg-grey round lg" form-type="submit">查询</button>
					</view>
				</form>

			</view>
		</view>
		<view :class="isDark?'dark':''" style="height: 200rpx;"></view>
		<zmm-watermark>

		</zmm-watermark>
	</view>
</template>
<script>
	export default {
		data() {
			return {
				kh: '',
				xm: '',
				sfzh: '',
				isDark: this.isDark,
				data: {}

			}
		},
		onShow() {
			let _this = this
			_this.kh = _this.$store.state.enrollInfo.kh
			_this.xm = _this.$store.state.enrollInfo.xm
			_this.sfzh = _this.$store.state.enrollInfo.sfzh
		},

		methods: {
			formSubmit: function(e) {

				let _this = this
				var formdata = e.detail.value
				let form = {
					kh: formdata.kh,
					xm: formdata.xm,
					sfzh: formdata.sfzh,
				}

				_this.$store.commit("enrollInfo", form)
				_this.$schoolApi.enrollInfo(form).then(function(response) {
					console.log(response)
					if (response.status == 0) {
						console.log(response.data)
						_this.data = response.data
						uni.showToast({
							icon: 'none',
							title: '查询成功',
							duration: 2000
						});
						_this.$Router.navigateTo("/pages/school/enroll/info")

					} else if (response.status != 608 && response.status != 603) {
						uni.showModal({
							title: '提示',
							content: response.msg,
							showCancel: false,
							success: function(res) {
								if (res.confirm) {

								} else if (res.cancel) {

								}
							}
						});
					}

					//这里只会在接口是成功状态返回
				}).catch(function(error) {
					//这里只会在接口是失败状态返回，不需要去处理错误提示
					console.log(error);




				});
			},

		}

	}
</script>

<style>
	.form {
		margin: 10rpx;
	}

	.imgCodeSrc {
		margin-top: 30rpx;
	}

	.viewInput {
		margin-left: 30rpx;
		margin-bottom: 20rpx;
	}

	.uni-form-item .title {
		padding: 20rpx 0;
	}

	.input {
		border: 1px solid #ccc;
		border-radius: 3px;
		margin-right: 20rpx;
		font-size: 17px;
		font-family: "Microsoft soft";
		padding: 7px 7px;
	}
</style>
